from fsm_blue import FSMController as BluePlayer
from fsm_red import FSMController as RedPlayer


def main():
    print("Exec Main Function")
    import os
    import time
    import json
    from Env.client import EnvClient
    client = EnvClient(0,0,0,0)
    client.reset()
    obs = client.get_observation()
    blue_player = BluePlayer()
    red_player = RedPlayer()
    blue_player.reset()
    red_player.reset()
    # client.speedup(0)
    
    cur_time = client._get_current_time()
    while True:
        cur_time+=10
        print('---'*10)
        cmds =  blue_player.step(obs)
        client.take_action(cmds)
        cmds = red_player.step(obs)
        client.take_action(cmds)
        obs = client.get_observation()
        # obs.print_state()
        # with open('data.json', 'w') as f:
            # json.dump(obs.state, f, ensure_ascii=False, indent=2)
        client.run_step(cur_time)



if __name__ == '__main__':
    main()
